# !/bin/bash

set -e

# ========================================================= #
# 添加 sherpa path ， pkg-config 用于查找和链接               #
# ========================================================= #
pkg_path=/opt/sherpa-onnx/aarch64-install-static-lib

# 检查 pkg_path 是否在 PKG_CONFIG_PATH 中
if [[ ":$PKG_CONFIG_PATH:" != *":$pkg_path:"* ]]; then
    # 如果不在 PKG_CONFIG_PATH 中，就添加它
    export PKG_CONFIG_PATH="$pkg_path:$PKG_CONFIG_PATH"
    echo "Added $pkg_path to PKG_CONFIG_PATH"
else
    echo "$pkg_path is already in PKG_CONFIG_PATH"
fi

export PKG_CONFIG_PATH="/opt/sherpa-onnx/aarch64-install-static-lib:$PKG_CONFIG_PATH"


echo $PKG_CONFIG_PATH

# pkg-config --cflags sherpa-onnx
# pkg-config --libs sherpa-onnx

rosmake

# make -j3

# sudo cp curl_gpt.sh /userdata/medgpt/curl_gpt.sh
# sudo cp build/bin/med_gpt_server /userdata/medgpt/

# sudo cp ./build/bin/med_gpt_server ./

# ./med_gpt_server
